﻿<script>
    var tempmodel = avalon.define({
        $id: "QYGG",
        name: "企业公告",

        ColumnData: [],
        modelData: (!pmodel.pageType && localStorage.getItem(pmodel.FormCode)) ? $.parseJSON(localStorage.getItem(pmodel.FormCode)) : { "GGTitle": "", "GGContent": "", "Files": "", "remark": "", "remark1": "", "JSUser": "" },
        iswf: false,//是否属于流程表单
        inittemp: function (strId) {
            $.getJSON('/API/FTAPI.ashx?Action=GETCOLUMNLIST', { P1: 6 }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.ColumnData = resultData.Result;
                    if (!tempmodel.modelData.remark) {
                        tempmodel.modelData.remark = resultData.Result[0].TypeNO;
                    }
                }
            })
            if (strId) {
                //编辑加载数据
                $.getJSON('/API/FTAPI.ashx?Action=GETQYGGMODEL', { P1: strId }, function (resultData) {
                    if (resultData.ErrorMsg == "") {
                        tempmodel.modelData = resultData.Result;
                        setTimeout(" ComFunJS.initForm()", 500)
                    }
                })
            } else {

                ComFunJS.initForm();
            }
        },//初始化
        SaveData: function (btdom, piid) {
            var data = tempmodel.modelData.$model;
            var modelValue = JSON.stringify(data);
            $.post("/API/FTAPI.ashx?ACTION=ADDQYGG", { P1: modelValue }, function (result) {
                var jsonresult = $.parseJSON(result)
                btdom.removeClass("disabled").find("i").hide();
                if ($.trim(jsonresult.ErrorMsg) == "") {
                    ComFunJS.winsuccessnew("操作成功");
                }
            });
        },
    });
    tempmodel.$watch("modelData.*", function (a, b) {
        if (!tempmodel.modelData.ID) {
            localStorage.setItem(pmodel.FormCode, JSON.stringify(tempmodel.modelData.$model));
        }
    })
</script>
<div class="form-horizontal" ms-controller="QYGG">
    <div class="form-group">
        <label class="col-xs-2 control-label">公告类别</label>
        <div class="col-xs-4">
            <select class="form-control " ms-duplex="modelData.remark" id="asdasd">
                <option ms-repeat-item="ColumnData" ms-attr-val="item.TypeNO" ms-attr-selected="item.TypeNO==modelData.remark?'selected':''">{{item.TypeNO}}</option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">公告标题</label>
        <div class="col-xs-9">
            <input type="text" value="" class="form-control szhl_require" ms-duplex="modelData.GGTitle" id="qygg" />
        </div>
    </div>

    <div class="form-group">
        <label class="col-xs-2 control-label">公告内容</label>
        <div class="col-xs-9">
            <textarea id="conNR" class="szhl_UEEDIT  szhl_require" ms-duplex="modelData.GGContent"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">通知人员</label>
        <div class="col-xs-9">
            <input type="text" value="" class="form-control  szhl_getPeoples" isall="Y"  ms-duplex="modelData.JSUser" id="qygg2" />
            <p class="text-danger">默认全部人员均能收到通知</p>
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">微信端图片</label>
        <div class="col-xs-9">
            <input type="text" value="" class="szhl_Upload form-control" ms-duplex="modelData.remark1" />
        </div>
    </div>
    <div class="form-group">
        <label class="col-xs-2 control-label">附件</label>
        <div class="col-xs-9">
            <input type="text" value="" class="szhl_Upload form-control" ms-duplex="modelData.Files" />
        </div>
    </div>

</div>